{% extends "base.html" %}

{% block content %}
<div class="mb-3">
    <a href="{{ url_for('add_note') }}" class="btn btn-primary">新建记录</a>
    <div class="btn-group ms-2">
        <a href="?type=daily" class="btn btn-outline-secondary {% if note_type == 'daily' %}active{% endif %}">每日</a>
        <a href="?type=weekly" class="btn btn-outline-secondary {% if note_type == 'weekly' %}active{% endif %}">每周</a>
        <a href="?type=monthly" class="btn btn-outline-secondary {% if note_type == 'monthly' %}active{% endif %}">每月</a>
    </div>
</div>

{% for note in notes %}
<div class="card mb-2">
    <div class="card-body">
        <h5 class="card-subtitle mb-2 text-muted">
            {{ note.timestamp.strftime('%Y-%m-%d') }}
            <span class="badge bg-secondary ms-2">{{ note.note_type }}</span>
        </h5>
        <p class="card-text">{{ note.content }}</p>
        <a href="{{ url_for('edit_note', id=note.id) }}" class="btn btn-sm btn-outline-secondary">编辑</a>
        <a href="{{ url_for('delete_note', id=note.id) }}" class="btn btn-sm btn-outline-danger">删除</a>
    </div>
</div>
{% endfor %}
{% endblock %}